package com.taiji.dianthus.sms;

/**
 * @author  h.m
 * @Desc 接口返回代码描述枚举
 */
public enum SMSResultCodeEnum {

    //成功
    SUCCESS(1,"提交成功"),
    CONTENT_IS_NULL(101,"smsContent为空"),
    MOBILES_IS_NULL(102,"mobiles为空"),
    MOBILES_IS_NULL_ARRAY(103,"mobiles为空数组"),
    ILLEGAL_NUMBER(104,"mobiles含有非法号码"),
    LOGIN_FAIL(105,"未进行身份认证或认证失败"),
    SIGN_IS_NULL(106,"SIGN为空"),
    OTHER_ERROR(107,"其他错误"),
    DUPLICATE_NUMBER(109,"mobiles含有重复号码"),
    OUT_OF_BOUNDS(110,"mobiles中号码数量超限（>5000），应≤5000"),
    TEMPID_IS_NULL(111,"tempId 为空"),
    THREAD_POOL_BUSY(112,"线程池忙")
    ;


    private Integer code;
    private String msg;

    SMSResultCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 根据代码获取代码描述信息
     * @param code
     * @return
     */
    public static String getResultMsg(int code) {
        SMSResultCodeEnum[] codeEnums = values();
        for(SMSResultCodeEnum resultCodeEnum :codeEnums) {
            if (resultCodeEnum.getCode().equals(code)) {
                return resultCodeEnum.getMsg();
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
